package boardgamer.common.client.board.testing;

import android.graphics.RectF;
import boardgamer.common.client.layout.HasLayout;
import com.google.common.base.Objects;

/**
* @author garysoed
*/
public class MockTile implements HasLayout {

  public String id = "";
  public RectF boundingRect = new RectF();
  
  public MockTile(String id) {
    this.id = id;
  }

  public MockTile(String id, RectF boundingRect) {
    this.id = id;
    this.boundingRect = boundingRect;
  }
  
  public MockTile(RectF boundingRect) {
    this.boundingRect = boundingRect;
  }

  @Override
  public void setBoundingRect(RectF boundingRect) {
    this.boundingRect = new RectF(boundingRect);
  }

  @Override
  public RectF getBoundingRect() {
    return new RectF(boundingRect);
  }

  @Override
  public String toString() {
    return Objects.toStringHelper(this)
        .add("id", id)
        .toString();
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
  
    if (!(obj instanceof MockTile)) {
      return false;
    }
  
    MockTile that = (MockTile)obj;
    return Objects.equal(this.id, that.id);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(id);
  }
}
